#pragma once

namespace lw
{
	template<class Iterator, class Ref, class Ptr>
	struct __reverse_iterator
	{
		typedef __reverse_iterator<Iterator, Ref, Ptr> Self;
		Iterator _iter;
		__reverse_iterator(Iterator it)
			:_iter(it)
		{}
		Self& operator++()
		{
			--_iter;
			return *this;
		}
		Self operator++(int)
		{
			Self tmp(*this);
			--_iter;
			return tmp;
		}
		Self& operator--()
		{
			++_iter;
			return *this;
		}
		Self operator--(int)
		{
			Self tmp(*this);
			++_iter;
			return tmp;
		}
		Ref operator*()
		{
			Iterator tmp(_iter);
			return *--tmp;
		}
		Ptr operator->()
		{
			return &operator*();
		}
		bool operator!=(const Self& s) const
		{
			return _iter != s._iter;
		}
		bool operator==(const Self& s) const
		{
			return _iter == s._iter;	
		}
	};
}
